#1,permission gruop 管理
from django.contrib.auth.models import Group
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from meiduo_admin.my_paginate import MyPageNumberPagination
from meiduo_admin.sysmange import admin_serializers
from users.models import User


class AdminMangerViewSet(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = admin_serializers.AdminMangerSerializer
    queryset = User.objects.filter(is_staff=True,is_superuser=True).order_by("id").all()


#2,permission group获取
class PermissionGruopView(ListAPIView):
    serializer_class = admin_serializers.PermissionGruopSerializer
    queryset = Group.objects.all()